import functools
@functools.total_ordering
class Time(object):
	#TODO, Implement timedelta functions if needed
	shifts=range(4)
	periods=range(36)
	def __init__(self,day,shift,period):
		self.day=day # days beginning with 0
		self.shift=shift # shifts beginning with 0==morning 6 oclock
		self.period=period # 36 pieces of 10 minute periods within a shift beginning with 0 maximum 60*6/10-1=35

	def __eq__(self,other):
		return self.day == other.day and self.shift == other.shift and self.period==other.period

	def normal_time(self):
		"Returns the stirng HHMM as normal hour and minutes"
		return str((6+self.shift*6)+(self.period*10)//60).rjust(2,'0')\
			   + str((self.period*10%60)).rjust(2,'0')

	def __repr__(self):
		return "Time(day={},shift={},period={})".format(self.day,self.shift,self.period)

	def __hash__(self):
		return hash(repr(self))

	def __lt__(self, other):
		return self.day < other.day and self.shift < other.shift and self.period < other.period
